<!DOCTYPE html>
<html lang="en">
<head>
    <{include file="header.html"}>
    <title>组卷管理-<{$user_data['school_name']}>-德安信会计在线教育平台</title>
</head>
<body>
<div class="wrap">
    <!--star left-->
    <div class="column">
        <{include file="left_menu.html"}>
    </div>
    <div id="ContMianBox">
        <!--star子栏目-->
        <div class="sub-colum">
            <div class="tit"><{$left_menu_min.menu}></div>
            <ul>
                <{foreach from=$left_menu_min.list item=item}>
                <li <{if $item['url'] == $left_menu_min.curr}>class="curr"<{/if}>><a href="<{$item['url']}>"><{$item['name']}></a></li>
                <{/foreach}>
            </ul>
        </div>
        <!--end子栏目-->
        <!--end left-->
        <div class="container narrow">
            <!--star conter-->
            <div class="cetContent">
                <div class="tit p-lr20">
                    <span class="curr">组卷管理</span>
                    <span><a href="/tiku/add_test_volume">新增组卷</a></span>
                </div>
                <!--star内容区域-->
                <div class="mainScroll">
                    <div class="mainContainer line-all">
                        <!--star tabMainCont-->
                        <div class="tabMainCont">
                            <!--star会员管理-->
                            <fieldset class="layui-elem-field">
                                <legend>筛选</legend>
                                <div class="layui-field-box">
                                    <form class="layui-form layui-form-pane1" method="post" action="/tiku/test_volume">
                                        <div class="layui-form-item">
                                            <div class="layui-inline">
                                                <select name="subject_id" id="subject_id">
                                                    <option value="0">选择科目</option>
                                                    <{foreach from=$subject item=item}>
                                                        <option value="<{$item.id}>" <{if  $conditions.subject_id == $item.id}>selected<{/if}>><{$item.title}></option>
                                                    <{/foreach}>
                                                </select>
                                            </div>

                                            <div class="layui-inline">
                                                <input type="text" class="layui-input" style="width:200px;" placeholder="组卷名称" value="<{if  $conditions.test_volume_name != 0}><{$conditions.test_volume_name}><{/if}>"  name="test_volume_name" />
                                            </div>

                                            <div class="layui-inline">
                                                <input type="text" name="st" placeholder="开始日"  class="layui-input" value='<{if $conditions['st'] != 0}><{$conditions['st']}><{/if}>' id="LAY_demorange_s">
                                            </div>
                                            <div class="layui-inline">
                                                <input type="text" name="et" placeholder="截止日"  class="layui-input" value='<{if $conditions['et'] != 0}><{$conditions['et']}><{/if}>' id="LAY_demorange_e">
                                            </div>
                                            
                                            <div class="layui-inline">
                                                <button type="submit" class="layui-btn">搜索</button>
                                                <a class="layui-btn" href="/tiku/add_test_volume"><i class="layui-icon"></i> 新增试卷</a>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </fieldset>
                            <table class="layui-table" lay-even lay-skin="row">
                                <thead>
                                    <tr>
                                        <th>序号</th>
                                        <th>科目</th>
                                        <th>添加老师</th>
                                        <th>组卷名称</th>
                                        <th>添加时间</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <{foreach from=$test_volume_list item=item}>
                                    <tr>
                                        <td class="tal"><{$item.id}></td>
                                        <td class="tal not_lb"><{$item.title}></td>
                                        <td class="tal not_lb"><{$item.teacher_name}></td>
                                        <td class="tal not_lb"><{$item.name}></td>
                                        <td class="tal not_lb"><{$item.add_time|date_format:'%Y-%m-%d <br/> %H:%M:%S'}></td>
                                        <td class="tal not_lb">
                                            <div class="colorBtn">
                                                <!-- <{if $item.publish_status == 3}>
                                                <p><a class="c-3283fa unpublish" publish_type="zt" href="javascript:;" volume_id="<{$item.id}>">已发布到真题冲刺</a></p>
                                                <p><a class="c-3283fa unpublish" publish_type="kq" href="javascript:;" volume_id="<{$item.id}>">已发布到考情速递</a></p>
                                                <{elseif $item.publish_status == 2}>
                                                <p><a class="c-3283fa publish" publish_type="zt" href="javascript:;" volume_id="<{$item.id}>">发布到真题冲刺</a></p>
                                                <p><a class="c-3283fa unpublish" publish_type="kq" href="javascript:;" volume_id="<{$item.id}>">已发布到考情速递</a></p>
                                                <{elseif $item.publish_status == 1}>
                                                <p><a class="c-3283fa unpublish" publish_type="zt" href="javascript:;" volume_id="<{$item.id}>">已发布到真题冲刺</a></p>
                                                <p><a class="c-3283fa publish" publish_type="kq" href="javascript:;" volume_id="<{$item.id}>">发布到考情速递</a></p>
                                                <{else}>
                                                <p><a class="c-3283fa publish" publish_type="zt" href="javascript:;" volume_id="<{$item.id}>">发布到真题冲刺</a></p>
                                                <p><a class="c-3283fa publish" publish_type="kq" href="javascript:;" volume_id="<{$item.id}>">发布到考情速递</a></p>
                                                <{/if}> -->
                                                <{if isset($item.type.1) AND $item.type.1 == 1}>
                                                     <a href="javascript:;">已发布到考情速递</a>
                                                <{else}>
                                                     <a href="javascript:;" class="publish" type="1" volume_id="<{$item.id}>">发布到考情速递</a>
                                                <{/if}>
                                                <{if isset($item.type.2) AND $item.type.2 == 1}>
                                                     <a href="javascript:;">已发布到真题冲刺</a>
                                                <{else}>
                                                     <a href="javascript:;" class="publish" type="2" volume_id="<{$item.id}>">发布到真题冲刺</a>
                                                <{/if}>
                                                <{if isset($item.type.3) AND $item.type.3 == 1}>
                                                     <a href="javascript:;">已发布到作业中心</a>
                                                <{else}>
                                                     <a href="javascript:;" class="zpublish" type="3" volume_id="<{$item.id}>">发布到作业中心</a>
                                                <{/if}>
                                                <{if isset($item.type.4) AND $item.type.4 == 1}>
                                                     <a href="javascript:;">已发布到考试中心</a>
                                                <{else}>
                                                     <a href="javascript:;" class="zpublish" type="4" volume_id="<{$item.id}>">发布到考试中心</a>
                                                <{/if}>
                                                <a href="/tiku/delete_volume/<{$item.id}>">删除组卷</a>
                                            </div>
                                        </td>
                                    </tr>
                                <{/foreach}>
                            </table>
                            <div class="pages p-tb20" style="text-align:right;">
                                <!-- <div class="l">
                                    <a href="javascript:;" class="zent-btn">你想要的按钮</a>
                                </div> -->
                                <{$pagination}>
                            </div>

                        </div>
                        <!--star会员管理-->
                    </div>
                    <!--end tabMainCont-->
                </div>
            </div>
        </div>
    </div>
</div>
<{include file="footer.html"}>
<script>
    layui.use(['form', 'jquery', 'layedit'], function(){
        var layedit = layui.layedit,form = layui.form(),$ = layui.jquery;
        $(".publish").click(function(){
            var _this = $(this);
            var volume_id = $(this).attr("volume_id");
            var type = $(this).attr("type");
            layer.prompt({title: '请输入该试卷的答题时长（单位：分钟）', formType: 3}, function(text, index){
                if(isNaN(text)){
                    layer.msg("时长必须是数字！", {icon:5, anim: 6});
                    return false;
                }
                layer.close(index);
                $.ajax({
                    type: "POST",
                    url: "/tiku/save_volume_publish",
                    dataType:"json",
                    data:{'type':type,'volume_id':volume_id, 'timeout':text},
                    success: function(result){
                        // layer.close(ii);
                        if(result.error == 0){
                            layer.msg(result.msg, {icon:6});
                            _this.text(result.msg);
                            _this.unbind("click");
                        }else{
                            layer.msg(result.msg, {icon:5});
                        }
                    }
                });
            });
        })
        // /classes/add_home_work
        $(".zpublish").click(function(){
            $(".zpublish").attr("id", "");
            $(this).attr("id", "now");
            var _this = $(this);
            var volume_id = $(this).attr("volume_id");
            var type = $(this).attr("type");
            layer.open({
                type: 2,
                title: '发布组卷',
                shadeClose: true,
                shade: 0.8,
                area: ['90%', '90%'],
                maxmin: true,
                content: '/tiku/test_volume_publish/'+volume_id+"/"+type //iframe的url
            }); 
        })
    });
</script>

<script>
    layui.use('laydate', function() {
        var laydate = layui.laydate;

        var start = {
            min: '2000-11-31 23:59:59',
            max: laydate.now(+1),
            istoday: false,
            choose: function(datas) {
                end.min = datas; //开始日选好后，重置结束日的最小日期
                end.start = datas //将结束日的初始值设定为开始日
            }
        };

        var end = {
            min: '2016-11-31 23:59:59',
            max: laydate.now(+1),
            istoday: false,
            choose: function(datas) {
                start.max = datas; //结束日选好后，重置开始日的最大日期
            }
        };

        document.getElementById('LAY_demorange_s').onclick = function() {
            start.elem = this;
            laydate(start);
        }
        document.getElementById('LAY_demorange_e').onclick = function() {
            end.elem = this
            laydate(end);
        }

    });
</script>
</body>
</html>
